﻿using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.Entities.BPM_Business.Reports;
using NP.BPMReportPlatform.MaterialMasterData.Dto;
using NP.BPMReportPlatform.Reports.CommonApprovalProcessReport.Dtos;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;

namespace NP.BPMReportPlatform.Reports.CommonApprovalProcessReport
{
    /// <summary>
    /// 船舶电子底账接口
    /// </summary>
    [Authorize]
    [ApiController]
    [Route("api/CBDZDZGL")]
    public class CBDZDZGLController : BPMReportPlatformController
    {
        private readonly ICBDZDZGLService _service;
        public CBDZDZGLController(ICBDZDZGLService service)
        {
            _service = service;
        }

        /// <summary>
        /// 修复数据
        /// </summary>
        /// <returns></returns>
        [HttpPost("FixData")]
        public async Task FixData()
        {
            await _service.FixData();
        }

        /// <summary>
        /// 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("GetTestSubDataList")]
        public async Task<PagedResultDto<CommonApprovalTestSubData>> GetTestSubDataList([FromBody] GetTestSubDataListInput input)
        {
            return await _service.GetTestSubDataList(input);
        }

        /// <summary>
        /// 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("ExportTestSubDataList")]
        public async Task<XlsxFileResult<CommonApprovalTestSubData>> ExportTestSubDataList([FromBody] GetTestSubDataListInput input)
        {
            var rst = await _service.ExportTestSubDataList(input);
            return new XlsxFileResult<CommonApprovalTestSubData>(rst, "导出Excel");
        }
    }
}
